<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
<title></title>
</head>

<body>
<script type="text/javascript">
    var sec=10;
    var timer;
    function hidepic(){
        if (sec==0){
            document.getElementById("textfield").value = "图片被隐藏";
            soccer.style.visibility =(soccer.style.visibility == "hidden") ? "visible" : "hidden";
        }else{
            document.getElementById("textfield").value = "图片会在 "+sec+" 秒后隐藏";
            setTimeout("hidepic()",1000);
        }
        sec--;
    }
    window.onload=function(){
        hidepic();
    }
</script>
<input id="textfield" type="text" size="15"><p>
<div id="soccer">
    <img border="0" src="img.jpg">
</div>

</body>
</html>
